<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="mainMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="0" />
<title>帐号管理</title>
<!--  通用情况下 不引入 js css  表单验证  js 放置到页面中 -->
<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#userName").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: {
					userName: {
						required: true,
						remote: "user!checkLoginName.action?oldLoginName=" + encodeURIComponent('${userName}')
					},
					name: "required",
					password: {
						required: true,
						minlength:3
					},
					passwordConfirm: {
						equalTo:"#password"
					},
					email:"email",
					checkedRoleIds:"required"
				},
				messages: {
					userName: {
						remote: "<font color='red'>用户登录名已存在</font>"
					},
					passwordConfirm: {
						equalTo: "<font color='red'>输入与上面相同的密码</font>"
					}
				}
			});
		});
	</script>
</head>

<body>
<!-- 直接主体内容开始  无需要涉及页面布局的  div 等   注意各页面中的Id 保持一致  页面中尽量用 el表达式 与html标签->
<!--   form定义 类似如下:  注意各页面中的Id 保持一致  class="inputForm"-->
<h2><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户</h2>
<form id="inputForm" action="user!save.action" method="post"
	class="yform"><input type="hidden" name="id" value="${id}" />
<table class="noborder">
	<tr class="type-text">
		<td>用户名&nbsp;<font color="red">*</font>:</td>
		<td><input type="text" id="userName" name="userName"
			value="${userName}" /></td>
	</tr>
	<tr class="type-text">
		<td>姓&nbsp;&nbsp;名&nbsp;<font color="red">*</font>:</td>
		<td><input type="text" name="name" id="name" value="${name}" /></td>
	</tr>
	<tr class="type-text">
		<td>密码&nbsp;<font color="red">*</font>:</td>
		<td><input type="password" id="password" name="password"
			value="${password}" /></td>
	</tr>
	<tr class="type-text">
		<td>确认密码&nbsp;<font color="red">*</font>:</td>
		<td><input type="password" id="passwordConfirm"
			name="passwordConfirm" value="${password}" /></td>
	</tr>
	<tr class="type-text">
		<td>邮箱&nbsp;<font color="red">*</font>:</td>
		<td><input type="text" id="email" name="email" value="${email}" /></td>
	</tr>
	<tr class="type-check">
		<td>角色&nbsp;<font color="red">*</font>:</td>
		<td><s:checkboxlist name="checkedRoleIds" list="allRoleList"
			listKey="id" listValue="roleName" theme="custom" /></td>
	</tr>
	<tr class="type-check">
		<td>是否激活</td>
		<td><select id="enable" name="enable">
			<option value="0">是</option>
			<option value="1">否</option>
		</select></td>
	</tr>
	<tr class="type-check">
		<td>是否过期</td>
		<td><select id="expired" name="expired">
			<option value="0">否</option>
			<option value="1">是</option>
		</select></td>
	</tr>
	<tr class="type-check">
		<td>是否锁定</td>
		<td><select id="locked" name="locked">
			<option value="0">是</option>
			<option value="1">否</option>
		</select></td>
	</tr>
	<tr class="type-check">
		<td>凭证是否过期</td>
		<td><select id="credexpired" name="credexpired">
			<option value="0">否</option>
			<option value="1">是</option>
		</select></td>
	</tr>
	<tr>
		<td colspan="2">
		<div class="type-button"><security:authorize
			ifAnyGranted="ROLE_修改用户">
			<input   type="submit" class="submit" value="提交" />&nbsp;
					</security:authorize> <input   type="reset" value="返回" class="reset"
			onclick="history.back()" /></div>
		</td>
	</tr>
</table>
</form>
</body>
</html>
